package com.shiftl.service.incense.server;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;
import com.shiftl.data.aroma.dao.DAOFactory;
import com.shiftl.data.aroma.dao.IncenseDAO;
import com.shiftl.data.aroma.dao.IngredientDAO;
import com.shiftl.data.aroma.entity.EntFactory;
import com.shiftl.data.aroma.model.Incense;
import com.shiftl.service.incense.client.IncenseAdminService;

/**
 * The server side implementation of the RPC service.
 */
@SuppressWarnings("serial")
public class IncenseAdminServiceImpl extends RemoteServiceServlet implements IncenseAdminService {
	public static IncenseDAO incDAO = DAOFactory.newDAO(IncenseDAO.class);
	public static IngredientDAO ingDAO = DAOFactory.newDAO(IngredientDAO.class);

	public String saveIncense(final Incense inc) {
		final Incense incEntity = EntFactory.newIncense(inc);
		incDAO.saveIncense(incEntity);
		return incEntity.getEncodedKey();
	}

	public Incense getIncense(final String id) {
		return incDAO.getIncense(id);
	}

}
